import { sequelize } from "../db/sequelize.js"
import { DataTypes } from "sequelize"

//创建数据库图书模型并导出
export const Book = sequelize.define('books', {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true
  },
  //书名
  bookName: {
    type: DataTypes.STRING
  },
  //作者
  author: {
    type: DataTypes.STRING
  },
  //简介
  descriptions: {
    type: DataTypes.STRING
  }
})

//导出同步数据库方法
export const sync = function () {
  sequelize.sync()
}

